<template>
  <div class="c-bg-sgray">
    <template v-if="orderVersion == 1">
      <new-search-bar @search="startSearch" @cancel="startSearch" :searchText="searchValue"></new-search-bar>
      <div class="c-bg-white">
        <my-small-tabbar :tabList="tabList" :tabIndex="type" @changeTab="changeType" class="c-ph24"></my-small-tabbar>
      </div>
      <div class="c-ph24">
        <div class="c-bg-white c-flex-column c-ph24 c-br20 c-p c-mt20" v-for="(item,index) in allOrderList" :key="index" @click="clickOrderItem(item)">
          <!-- 商品 -->
          <template v-if="item.fromOrderType != 1">
            <div class="c-bd-b1 c-flex-row c-justify-sb c-pv24">
              <div class="c-lh c-fc-gray c-fs20 c-flex-row c-aligni-center">
                <span>{{item.createdAt}}</span>
                <span class="c-fc-sblack c-fs20 c-aligni-center c-ml12">商城商品</span>
                <span class="theme-bg c-fc-white c-fs20 c-pv4 c-ph8 c-br4 c-ml12" v-if="item.deliverType == 2">自提</span>
              </div>
              <div class="c-lh c-fs22 theme-fc">{{item.finalBalanceTimeStatus != null && item.finalBalanceTimeStatus == 2 && item.finalBalanceStatus == 0 ? '已关闭' : item.finalBalanceStatus != null && item.finalBalanceStatus == 0 && item.status == 1 && item.finalBalanceTimeStatus != 2 ? '等待付尾款' : orderStatus[item.status]}}</div>
            </div>
            <div class="c-flex-row c-pt20 c-pb20" v-for="(cItem,cIndex) in item.orderDetail" :key="cIndex">
              <div class="c-ww180 c-hh180 c-text-hidden c-br10">
                <img :src="$addXossFilter(cItem.avatar, require('@/assets/defult270.png'))" class="c-w100 c-h c-br10 imgCloseBig c-object-fit-cover" />
              </div>
              <div class="c-flex-column c-justify-sb c-hh180 c-pl20 c-w0 c-flex-grow1">
                <div class="c-flex-row c-justify-sb c-w100">
                  <div class="c-w0 c-flex-grow1">
                    <div class="c-fs24 c-text-ellipsis1 c-lh34">
                      <span v-if="item.type == 2048" class="c-fs20 theme-bd1 theme-fc c-ph4 c-pv2 c-br4 c-mr10">预售</span>
                      <span v-if="cItem.isGift && cItem.isGift == 1" class="c-fs20 theme-bd1 theme-fc c-ph4 c-pv2 c-br4 c-mr10">赠品</span>
                      <span v-if="item.type == 2" class="c-fs20 theme-bg c-fc-white c-mr4 c-textAlign-c c-br4 c-pv4 c-ph8 c-br20">限时{{Number(cItem.price) == 0 ? '免费' : '折扣'}}</span>{{cItem.goodsName}}
                    </div>
                    <div class="c-fs20 c-fc-gray c-mt10 c-text-ellipsis3" v-if="cItem.subSpecs">规格：{{cItem.subSpecs}}</div>
                  </div>
                  <div class="c-flex-column c-aligni-end">
                    <span class="c-fs24 c-fc-xblack">{{'￥' | iosPriceFilter}}{{item.type == 4096 || item.type == 1024 ? cItem.prodPrice : cItem.price}}</span>
                    <span class="c-fs20 c-fc-gray c-mt5">x {{cItem.quantity}}</span>
                  </div>
                </div>
                <div class="c-flex-row c-aligni-center c-justify-end">
                  <span class="theme-fc c-fs20 c-w0 c-flex-grow1" v-if="item.status == 1 && cItem.deliverStatus == 2">已发货</span>
                  <span class="theme-fc c-fs20" v-if="cItem.afterStatus > 0">{{cItem.refundType == 1 ? '退款' : '退货'}}{{cItem.afterStatus == 1 ? '中' : '成功'}}</span>
                </div>
              </div>
            </div>
          </template>
          <!-- 知识产品 -->
          <template v-else>
            <div class="c-flex-row c-justify-sb c-aligni-center c-bd-b1 c-pv15">
              <div class="c-flex-row c-aligni-baseline">
                <span class="c-fc-sblack c-fs20 c-aligni-center">{{item.payAt ? item.payAt.substr(0,16) : item.createdAt.substr(0,16)}}</span>
                <span class="c-fc-sblack c-fs20 c-aligni-center c-ml12">
                  {{(item.tags & 1048576) == 1048576 ? groupPurchaseMap[item.prodType] : (item.tags & 2) == 2 ? collageMap[item.prodType] : (item.tags & 4096) == 4096 ? bargainMap[item.prodType] : (item.tags & 8) == 8 ? salesMap[item.prodType] : (item.tags & 4194304) == 4194304 ? '推荐有礼' + typeMap[item.prodType] : ((item.tags & 524288) == 524288 ? '实物带货' + typeMap[item.prodType] :item.prodType == cfrom.activity ? '活动购票':  '购买' + typeMap[item.prodType])}}{{item.prodType ? '' : item.desc}}
                </span>
                <!-- tags 4/12:买赠 8:限时购 2:拼团 4096:砍价 -->
              </div>
              <!-- jwFlag判断是否是教务订单 -->
              <template v-if="item.jwFlag == 0">
                <span class="c-fs22 theme-fc" v-if="item.collageTeamStatus == 1">拼团中</span>
                <span class="c-fs22 theme-fc" v-else>{{item.status==1?'完成':item.status==0?'待付款':item.status==-1?'交易关闭':item.status==-3?'已退款':item.status==-9?'欠费中':'已关闭'}}</span>
              </template>
              <template v-else>
                <span class="c-fs22" :class="item.status==1 ? 'c-fc-green' : item.status==0 ? 'c-fc-sorange' : 'c-fc-gray'">已换课</span>
              </template>
            </div>
            <div class="c-flex-row c-justify-sb c-pv20">
              <div>
                <div class="c-ww180 c-text-hidden c-br10" :class="(item.prodType == cfrom.ebooks) || (item.prodType == cfrom.presentEbooks) ? '' : 'c-maxh120'">
                  <vip-custom-img :cover="item.vipInfo ? item.vipInfo.cover : {}" :coverUrl="item.avatar || ''" :prodType="item.prodType" :imgClass="'imgCloseBig c-br10'" :fontClass="{
                    boxStyle: 'c-pv20 c-pl12',
                    name: 'c-fs24 c-text-ellipsis1 c-fw-b',
                    duration: 'c-fs18'}" :content="item.vipInfo ? {name: item.vipInfo.name, duration: item.vipInfo.duration, durationType: item.vipInfo.durationType} : {}" />
                </div>
              </div>
              <!-- 知识产品 -->
              <div class="c-pl20 c-w0 c-flex-grow1 c-hh120 c-flex-column c-justify-sb">
                <div>
                  <div class="c-fs24 c-fc-xblack c-text-ellipsis1">
                    <span v-if="item.prodType==cfrom.systemPresentColumn" class="c-fc-deepGreen">【赠送】</span>{{item.prodName}}
                  </div>
                  <div v-if="item.prodType==cfrom.activity" class="c-flex-column c-aligni-end">
                    <span class="c-fs20 c-fc-gray c-mt5">x {{item.quantity}}</span>
                  </div>
                </div>

                <div v-if="(item.tags & 1048576) == 1048576 && item.status != 0" @click.stop="goGroupPurchaseTicket(item.orderId)" class="c-fs22 c-ww148 c-hh50 c-flex-row c-flex-center theme-bg-10 theme-fc c-br25">我的票券</div>
                <!-- 退款 或者 营销活动 或者 推荐有礼 或者 购买实体赠送，不展示 -->
                <div v-if="isShowGift(item)" class="c-flex-row c-flex-center c-hh32 c-ww148 theme-bg c-textAlign-c c-br20">
                  <span class="iconfont c-fs20 c-fc-white">&#xec6d;</span>
                  <span class="c-fc-white c-fs20 c-ml4">内含礼包</span>
                </div>
                <!-- 推荐有礼 -->
                <div v-if="(item.tags & 4194304) == 4194304 && item.isBeTaskReward" class="c-flex-row c-flex-center c-hh32 c-ww210 theme-bg c-textAlign-c c-br20">
                  <span class="iconfont c-fs20 c-fc-white">&#xec6d;</span>
                  <span class="c-fc-white c-fs20 c-ml4">内含推荐活动礼包</span>
                </div>
              </div>
              <!-- v-if="item.prodType==cfrom.systemPresentColumn 赠送标识 旧数据才有这个判断 -->
              <div v-if="item.prodType==cfrom.systemPresentColumn" class="c-pa c-p-t0 c-p-r0 c-pz1">
                <img src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/mall/orderZeng.png" class="c-ww50 c-hh50 c-block" />
              </div>
            </div>
          </template>
          <div class="c-flex-row c-aligni-center c-justify-end c-bd-b1-f6 c-pb24 c-w100">

            <div v-if="item.payMethod == 4 && item.offlinePayMoney" class="c-lh28 c-fc-xblack c-fs20 c-ml14">线下实付款{{'￥' | iosPriceFilter}}<span class="c-fs28" v-html="item.offlinePayMoney">{{item.offlinePayMoney}}</span></div>
            <div v-else class="c-lh28 c-fc-xblack c-fs20 c-ml14">{{item.finalBalanceStatus != null && item.status == 0 ? '需付定金' : item.finalBalanceStatus == 0 && item.status > 0 ? '已付定金' : '线上实付款'}}：{{'￥' | iosPriceFilter}}<span class="c-fs28" v-html="item.payMoney">{{item.payMoney}}</span></div>
          </div>
          <div class="c-flex-column c-aligni-end">
            <!-- 添加此处按钮,需要考虑一下内页也有相同按钮,操作完之后,页面要怎么局部更新 -->
            <div class="c-lh c-fs24 c-flex-row c-justify-end c-aligni-center c-w100">
              <template v-if="item.fromOrderType != 1">
                <template v-if="!!item.finalBalanceStatus && item.finalBalanceStatus != 1">
                  <div class="c-pv30 c-flex-row c-aligni-center c-justify-sb c-w100" v-if="(item.finalBalanceTimeStatus == 0 || item.finalBalanceTimeStatus == 1) && item.status == 1">
                    {{item.finalBalanceTimeStatus == 0 ? '' : '请在'}}{{getLeaveTime(item)}}
                    <div class="c-br28 c-fs24 c-pv12 c-ph24 c-ml20" :class="item.finalBalanceTimeStatus == 1 ? 'theme-bd1 theme-fc' : 'c-bd1-ccc c-fc-sgray'" @click.stop="clickPay(item)">支付尾款</div>
                  </div>
                  <div class="c-pv30 c-flex-row c-aligni-center c-justify-sb c-w100" v-if="item.finalBalanceTimeStatus == 2 && item.status >= 0">
                    已结束，未在指定时间内支付尾款
                    <div class="c-br28 c-fs24 c-pv12 c-ph24 c-ml20 c-bd1" v-if="item.enableRefund == 1" @click.stop="goApplyRefund(item)">退定金</div>
                  </div>
                </template>
                <div v-show="[-1,-2,-3,-5].includes(item.status) && !item.finalBalanceTimeStatus == 2" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelOrder(item.goId, 1)">删除订单</div>
                </div>
                <div v-show="item.status == 0" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelOrder(item.goId, 2)">取消订单</div>
                </div>

                <!-- 预售 待支付尾款不展示 -->
                <div v-show="(item.status == 0 || (item.status == 1 && item.isSendSomeGoods == 0)) && item.updateAddressTime == null && item.orderDetail[0].deliverType != 2 && (item.finalBalanceTimeStatus && item.finalBalanceTimeStatus == 0)" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="handleClickAddress(item.goId)">修改地址</div>
                </div>
                <div v-show="showLogistics(item)" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickLogistics(index, item.isSplitPackage, item.goId)">物流信息</div>
                </div>
                <div v-show="item.status == 0" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickPay(item)">付款</div>
                </div>
                <div v-show="item.status == 3 && (item.isCommented == 0 || !item.isCommented)" class="c-pv30">
                  <div class="c-fs24 c-lh32 c-pv8 c-ph24 c-br28 c-ml20 theme-bd1 theme-fc" @click.stop="goComments(item)">评价</div>
                </div>
                <div v-show="item.status == 2 && item.fromApp != 10" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickConfirmReceipt(item)">确认收货</div>
                </div>
                <div v-show="item.payAward != null" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickPay(item)">支付有礼</div>
                </div>
                <div class="c-fs24 c-fc-xblack c-ml20 c-pv30" v-show="(item.finalBalanceStatus == undefined || (item.finalBalanceStatus != undefined && item.finalBalanceStatus == 1)) && item.status == 1 && item.deliverType == 2 && item.deliverNo && item.deliverNo.length > 0">提货码：{{item.deliverNo}}</div>
              </template>
              <!-- 知识产品 -->
              <template v-if="item.fromOrderType == 1">
                <div v-show="item.prodType != 5 && item.prodType != 9 && item.prodType != 61 && item.prodType != 78 && item.status==1 && (item.consigneeAddress != null || item.consigneeName != null || item.consigneePhone != null)" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="checkConsigneeInfo(item)">查看快递</div>
                </div>
                <div v-show="item.status==0 && (item.orderId || item.orderNo)" class="c-pv30">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelKnowledgeOrder(item.orderId, item.orderNo)">取消订单</div>
                </div>
                <div v-show="item.status==0 && item.orderId" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="toPay(index)">{{'付款' | iosPayText(item.prodType)}}</div>
                </div>
                <div v-show="item.payAward != null && (item.tags & 1048576) != 1048576" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickPay(item)">支付有礼</div>
                </div>
                <div v-if="item.prodType == cfrom.edu && item.status == 1" class="c-pv30">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="goEduCourseDetail(item.prodId)">再次购买</div>
                </div>
                <!-- 活动 -->
                <template v-if="item.prodType==cfrom.activity">
                  <div v-show="isShowGift(item)" class="c-pv30">
                    <div class="c-bd1-ccc c-fc-xblack c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="openGifts(item)">领取礼包</div>
                  </div>
                  <div v-show="(item.status == 1 || (item.enrollRefundStatus ==1 && item.refundReason ==1))&& item.collageTeamStatus != 1" class="c-pv30">
                    <div class="c-bd1-ccc c-fc-xblack c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="toTickInfo(item)">查看票券</div>
                  </div>
                </template>
              </template>
            </div>
          </div>
        </div>
      </div>
      <div class="c-pf c-bg-white c-p-l0 c-p-r0 c-pv24 c-mlr-auto c-p-b0 c-ph24" v-show="type == 3">
        <div class="c-fc-xblack c-bd1-ccc c-br36 c-flex-row c-aligni-center c-justify-center c-fs24 c-lh34 c-ww600 c-hh64 c-mlr-auto" @click="goToCommentList">查看已评价内容</div>
      </div>

      <cj-popup v-model="isShowAddressInfo" round>
        <div class="c-ww540 c-textAlign-c">
          <div class="c-mt40 c-mb30 c-ph40 c-fc-xblack">
            <div class="c-fs28">快递详情</div>
            <div class=" c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">收货人：</div>
              <div>{{currentConsigneeData != null ? currentConsigneeData.consigneeName : ''}}</div>
            </div>
            <div class=" c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">联系电话：</div>
              <div>{{currentConsigneeData != null ? currentConsigneeData.consigneePhone : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-start c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">收货地址：</div>
              <div class="c-textAlign-l">{{currentConsigneeData != null ? currentConsigneeData.consigneeArea + currentConsigneeData.consigneeAddress : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">快递名称：</div>
              <div class="">{{currentConsigneeData != null && currentConsigneeData.expressName != null ? currentConsigneeData.expressName : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">快递单号：</div>
              <div>{{currentConsigneeData != null && currentConsigneeData.expressNumber != null ? currentConsigneeData.expressNumber : ''}}</div>
            </div>
          </div>
          <div class="c-flex-row c-w100 c-aligni-center c-justify-center c-mt30 c-mb30">
            <div @click="isShowAddressInfo = false" class="c-fs22 c-fc-white c-ww220 c-hh50 c-flex-row c-aligni-center c-justify-center c-br30 knowBtn">
              <div>我知道了</div>
            </div>
          </div>
        </div>
      </cj-popup>
      <loading-status-tem :isFromSearch="true" :dataStatus="dataStatus" noDataText="暂无订单"></loading-status-tem>
    </template>
    <template v-if="orderVersion == 2">
      <new-search-bar @search="startSearch" @cancel="startSearch" :placeholder="'请输入商品名称'" :searchText="searchValue"></new-search-bar>
      <div class="c-bg-white">
        <my-small-tabbar :tabList="tabList" :tabIndex="type" @changeTab="changeType" class="c-ph24"></my-small-tabbar>
      </div>
      <div class="c-ph24">
        <div class="c-bg-white c-flex-column c-ph24 c-br20 c-p c-mt20" v-for="(item,index) in allOrderList" :key="index" @click="clickOrderItem(item)">
          <template>
            <div class="c-flex-row c-justify-sb c-aligni-center c-bd-b1 c-pv15 c-fs22">
              <div>
                {{item.payAt ? item.payAt.substr(0,16) : item.createdAt.substr(0,16)}}
              </div>
              <!-- jwFlag判断是否是教务订单 -->
              <template v-if="item.jwFlag == 0 || item.jwFlag == null">
                <span class="theme-fc" v-if="isShowCollageInfo(item)">待成团</span>
                <span class="theme-fc" v-else-if="item.status == 200 && item.tags && item.tags.includes(67108864) && item.presaleInfo && item.presaleInfo.finalBalanceTimeStatus != 2">等待付尾款</span>
                <span class="theme-fc" v-else-if="item.status == 200 && item.tags && item.tags.includes(67108864) && item.presaleInfo && item.presaleInfo.finalBalanceTimeStatus == 2">已关闭</span>
                <span class="theme-fc" v-else>{{orderStatusV2[item.pageStatus]}}</span>
              </template>
              <template v-else>
                <span :class="item.status==1 ? 'c-fc-green' : item.status==0 ? 'c-fc-sorange' : 'c-fc-gray'">已换课</span>
              </template>
            </div>
            <div class="c-pv20" v-for="(cItem,cIndex) in item.orderDetail" :key="cIndex">
              <div class="c-flex-row">
                <div class="c-text-hidden c-br12 c-p" :class="EQUAL_SCALE_IMG_TYPE.includes(`${cItem.prodType}`) ? 'c-ww180 c-hh180' : 'c-ww180 c-hh120'">
                  <CoverImg :coverUrl="getProdCover(cItem)" :prodType="cItem.prodType" />
                  <div class="c-br8 c-hh28 c-lh30 c-ph6 c-textAlign-c c-translucent-balck60 c-fs18 c-fc-white c-pa c-p-b8 c-p-r8 c-pz9">{{cItem.prodType == cfrom.collocationBuy ? (item.prodsCollocation && item.prodsCollocation.comboType == 1 ? '自选套餐' : '固定套餐') : getProdTypeText(cItem)}}</div>
                </div>
                <!-- 知识产品 -->
                <div class="c-pl20 c-w0 c-flex-grow1 c-flex-column c-justify-sb">
                  <div class="c-flex-row">
                    <div class="c-flex-grow1 c-w0 c-fs24 c-fc-xblack c-text-ellipsis2">
                      <span v-if="cItem.prodSrc == 300 || cItem.prodSrc == 302 || cItem.prodSrc == 303 ||cItem.prodSrc == 304" class="c-fs18 theme-bg c-fc-white c-ph4 c-br4 c-pv2 c-inlineblack c-mr4">赠品</span>
                      <span v-if="cItem.prodType==cfrom.systemPresentColumn" class="c-fc-deepGreen">【赠送】</span><span>{{cItem.prodName}}</span>
                    </div>
                    <div class="c-ml10">
                      <div v-if="getIsShowPrice(item, cItem)" class="c-fs24 c-fc-xblack">{{'￥' | iosPriceFilter}}{{cItem.prodPrice}}</div>
                      <div class="c-fs22 c-fc-gray c-mt6 c-textAlign-r">x {{cItem.quantity}}</div>
                      <div v-if="isShowRefundTxt(cItem)" class="c-fs20 c-fc-xmlred c-mt6 c-textAlign-r">{{getAfterStatusTxt(cItem)}}</div>
                    </div>
                  </div>
                  <div class="c-fs20 c-fc-gray c-text-ellipsis3" v-if="cItem.subSpecs && cItem.prodType == cfrom.shopping">规格：{{cItem.subSpecs}}</div>
                  <!-- 退款 或者 营销活动 或者 推荐有礼 或者 购买实体赠送，不展示 -->
                  <div v-if="isShowGift(cItem)" class="c-mt10 c-flex-row c-flex-center c-hh32 c-ww148 theme-bg c-textAlign-c c-br20">
                    <span class="iconfont c-fs20 c-fc-white">&#xec6d;</span>
                    <span class="c-fc-white c-fs20 c-ml4">内含礼包</span>
                  </div>
                  <div class="c-flex-row c-aligni-center c-flexw-wrap">
                    <div v-for="(tItem, tIndex) in item.tags" :key="tIndex" v-show="marketingmap[tItem] && cItem.prodSrc != 300 && cItem.prodSrc != 302 && cItem.prodSrc != 303 && cItem.prodSrc != 304" class="c-flex-shrink0 c-mt8 c-fs18 theme-bd1 theme-bg-10 theme-fc c-ph6 c-pv2 c-br8 c-ml10">{{marketingmap[tItem]}}</div>
                  </div>
                </div>

                <div v-if="cItem.prodType==cfrom.systemPresentColumn" class="c-pa c-p-t0 c-p-r0 c-pz1">
                  <img src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/mall/orderZeng.png" class="c-ww50 c-hh50 c-block" />
                </div>
              </div>
              <!-- 售后状态 -->
              <!-- <div v-if="isShowRefundTxt(cItem)" class="c-fs20 theme-fc c-pt20 c-textAlign-r">{{getAfterStatusTxt(cItem)}}</div> -->
              <!-- 发货状态 -->
              <div v-if="isShowExpressStatus(item, cItem)" class="c-fs20 theme-fc c-pt20 c-textAlign-r">已发货</div>
            </div>
          </template>
          <div class="c-flex-row c-aligni-center c-justify-end c-bd-b1-f6 c-pb24 c-w100">
            <div v-if="item.paymentMethod == 4" class="c-lh28 c-fc-xblack c-fs20 c-ml14">线下实付款<span class="c-fc-xmlred">{{'￥' | iosPriceFilter}}</span><span class="c-fs28 c-fc-xmlred" v-html="item.payMoney">{{item.payMoney}}</span></div>
            <!-- 预售未支付 -->
            <div v-else-if="item.tags && item.tags.includes(67108864) && item.status == 0" class="c-lh28 c-fc-xblack c-fs20 c-ml14">需付定金：<span class="c-fc-xmlred">{{'￥' | iosPriceFilter}}</span><span class="c-fs28 c-fc-xmlred" v-html="item.payMoney">{{item.payMoney}}</span></div>
            <div v-else-if="item.tags && item.tags.includes(67108864) && item.status == 200" class="c-lh28 c-fc-xblack c-fs20 c-ml14">已付定金: <span class="c-fc-xmlred">{{'￥' | iosPriceFilter}}</span><span class="c-fs28 c-fc-xmlred" v-html="item.payMoney">{{item.payMoney}}</span></div>
            <div v-else class="c-lh28 c-fc-xblack c-fs20 c-ml14">线上实付款：<span class="c-fc-xmlred">{{'￥' | iosPriceFilter}}</span><span class="c-fs28 c-fc-xmlred" v-html="item.payMoney">{{item.payMoney}}</span></div>
          </div>
          <div class="c-flex-column c-aligni-end">
            <!-- 添加此处按钮,需要考虑一下内页也有相同按钮,操作完之后,页面要怎么局部更新 -->
            <div class="c-lh c-fs24 c-flex-row c-justify-end c-aligni-center c-w100">
              <template>
                <template v-if="item.tags && item.tags.includes(67108864) && item.presaleInfo">
                  <div class="c-pv20 c-flex-row c-aligni-center c-justify-sb c-w100" v-if="(item.presaleInfo.finalBalanceTimeStatus == 0 || item.presaleInfo.finalBalanceTimeStatus == 1) && item.status == 200">
                    {{item.presaleInfo.finalBalanceTimeStatus == 0 ? '' : '请在'}}{{getLeaveTime(item)}}
                    <div class="c-br28 c-fs24 c-pv12 c-ph24 c-ml20" :class="item.presaleInfo.finalBalanceTimeStatus == 1 ? 'theme-bd1 theme-fc' : 'c-bd1-ccc c-fc-sgray'" @click.stop="clickPay(item)">支付尾款</div>
                  </div>
                  <div class="c-pv20 c-flex-row c-aligni-center c-justify-sb c-w100" v-if="item.presaleInfo.finalBalanceTimeStatus == 2 && !item.pageStatus">
                    已结束，未在指定时间内支付尾款
                    <div class="c-br28 c-fs24 c-pv12 c-ph24 c-ml20 c-bd1" v-if="isShowRefundBalance(item)" @click.stop="goApplyRefund(item)">退定金</div>
                  </div>
                </template>
                <div v-show="isShowDeleteOrder(item)" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelOrder(item.orderId, 1)">删除订单</div>
                </div>
                <div v-show="item.pageStatus==0 && (item.orderId || item.orderNo) && item.orderDetail[0].prodType != cfrom.shopping" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelKnowledgeOrder(item.orderId, item.orderNo)">取消订单</div>
                </div>
                <div v-show="item.status == 0 && hasShoppingGoods(item)" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickCancelOrder(item.orderId, 2)">取消订单</div>
                </div>
                <!-- <div v-show="(item.status == 0 || (item.status == 100 && item.isSendSomeGoods == 0)) && item.updateAddressTime == null && item.orderDetail[0].deliverType != 2 && (item.presaleInfo && item.presaleInfo.finalBalanceTimeStatus && item.presaleInfo.finalBalanceTimeStatus == 0)" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="handleClickAddress(item.haveGiftMallProd ? item.goId : item.orderId)">修改地址</div>
                </div> -->
                <div v-show="showConsigneeInfo(item)" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="checkConsigneeInfo(item)">查看快递</div>
                </div>
                <div v-show="showLogistics(item)" class="c-pv20">
                  <div class="c-bd1 c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="clickLogistics(index, item.isSplitPackage, item.haveGiftMallProd ? item.goId : item.orderId)">物流信息</div>
                </div>
                <div v-show="item.pageStatus == 3 && item.commentStatus == 2" class="c-pv20">
                  <div class="c-fs24 c-lh32 c-pv8 c-ph24 c-br28 c-ml20 theme-bd1 theme-fc" @click.stop="goComments(item)">评价</div>
                </div>
                <div v-if="item.orderDetail[0].prodType == cfrom.edu && item.status == 100" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="goEduCourseDetail(item.orderDetail[0].prodId)">再次购买</div>
                </div>
                <div v-if="item.orderDetail[0].prodType == cfrom.booking && item.pageStatus != 0 && item.pageStatus != 4" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="goMyBooking()">我的预约</div>
                </div>
                <div v-if="isShowCollageInfo(item)" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="goCollageDetail(item)">拼团详情</div>
                </div>
                <div v-if="item.tags.includes(1048576) && item.status == 100" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="goGroupPurchaseTicket(item.orderId)">我的票券</div>
                </div>
                <!-- 活动 -->
                <template v-if="item.orderDetail[0].prodType==cfrom.activity">
                  <!-- <div v-show="item.isGiftRelate && (item.status == 309 || item.status == 100)" class="c-pv30">
                    <div class="c-bd1-ccc c-fc-xblack c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="openGifts(item)">领取礼包</div>
                  </div> -->
                  <div v-show="(item.status == 100 || (item.activityEnroll && item.activityEnroll.enrollRefundStatus ==1 && item.activityEnroll.refundReason ==1))&& !(item.isCollage == 1 && item.collageStatus == 2)" class="c-pv20">
                    <div class="theme-bd1 theme-fc c-br28 c-fs24 c-pv12 c-ph24 c-ml20" @click.stop="toTickInfo(item)">查看票券</div>
                  </div>
                </template>
                <div v-show="isShowComfirmReceipt(item)" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickConfirmReceipt(item)">确认收货</div>
                </div>
                <div v-show="item.pageStatus==0 && (item.orderId || item.orderNo) && item.orderDetail[0].prodType != cfrom.shopping" class="c-pv20">
                  <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickListPay(index)">{{'去支付' | iosPayText(item.prodType)}}</div>
                </div>
                <template v-if="hasShoppingGoods(item)">
                  <div v-show="item.status == 0" class="c-pv20">
                    <div class="theme-bd1 c-br28 c-fs24 theme-fc c-pv12 c-ph24 c-ml20" @click.stop="clickPay(item)">去支付</div>
                  </div>
                </template>
              </template>
            </div>
          </div>
          <div class="c-pb20 c-pb24" v-if="isShowCollageInfo(item)">
            <div class="c-fs22 c-fc-xblack c-ph20 c-bg-sgray c-br8 c-hh58 c-flex-row c-aligni-center">
              拼团剩余时间：<cj-clocker :time="item.collageInfo.endTime" format="%D天%H时%M分%S秒" @on-finish="finishFn(item)">
                <template v-slot="{ timeInfo }">
                  <div class="c-flex-row c-aligni-center">
                    <div class="c-mr4"><span class="theme-fc c-fw-b c-ph4">{{timeInfo.D}}</span>天</div>
                    <div class="c-ww36 c-hh36 c-flex-row c-flex-center theme-bg c-fc-white c-br8">{{timeInfo.H}}</div>
                    <div class="c-ph4">时</div>
                    <div class="c-ww36 c-hh36 c-flex-row c-flex-center theme-bg c-fc-white c-br8">{{timeInfo.M}}</div>
                    <div class="c-ph4">分</div>
                    <div class="c-ww36 c-hh36 c-flex-row c-flex-center theme-bg c-fc-white c-br8">{{timeInfo.S}}</div>
                    <div class="c-ph4">秒</div>
                  </div>
                </template>
              </cj-clocker>
            </div>
          </div>
          <!-- <div  class="c-pv20 c-w0 c-flex-grow1">

          </div> -->
        </div>
      </div>
      <div class="c-pf c-bg-white c-p-l0 c-p-r0 c-pv24 c-mlr-auto c-p-b0 c-ph24" v-show="type == 3">
        <div class="c-fc-xblack c-bd1-ccc c-br36 c-flex-row c-aligni-center c-justify-center c-fs24 c-lh34 c-ww600 c-hh64 c-mlr-auto" @click="goToCommentList">查看已评价内容</div>
      </div>

      <cj-popup v-model="isShowAddressInfo" round>
        <div class="c-ww540 c-textAlign-c">
          <div class="c-mt40 c-mb30 c-ph40 c-fc-xblack">
            <div class="c-fs28">快递详情</div>
            <div class=" c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">收货人：</div>
              <div>{{currentConsigneeData != null ? currentConsigneeData.consigneeName : ''}}</div>
            </div>
            <div class=" c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">联系电话：</div>
              <div>{{currentConsigneeData != null ? currentConsigneeData.consigneePhone : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-start c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">收货地址：</div>
              <div class="c-textAlign-l">{{currentConsigneeData != null ? currentConsigneeData.consigneeArea + currentConsigneeData.consigneeAddress : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">快递名称：</div>
              <div class="">{{currentConsigneeData != null && currentConsigneeData.expressName != null ? currentConsigneeData.expressName : ''}}</div>
            </div>
            <div class="c-flex-row c-aligni-center c-fs24 c-mt20">
              <div class="c-fc-gray c-ww140 c-flex-shrink0 c-textAlign-r">快递单号：</div>
              <div>{{currentConsigneeData != null && currentConsigneeData.expressNumber != null ? currentConsigneeData.expressNumber : ''}}</div>
            </div>
          </div>
          <div class="c-flex-row c-w100 c-aligni-center c-justify-center c-mt30 c-mb30">
            <div @click="isShowAddressInfo = false" class="c-fs22 c-fc-white c-ww220 c-hh50 c-flex-row c-aligni-center c-justify-center c-br30 knowBtn">
              <div>我知道了</div>
            </div>
          </div>
        </div>
      </cj-popup>
      <loading-status-tem :isFromSearch="true" :dataStatus="dataStatus" noDataText="暂无订单"></loading-status-tem>
    </template>
  </div>
</template>

<script>
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import VipCustomImg from "@/components/templates/common/VipCustomImg.vue";
import newSearchBar from "@/components/templates/common/newSearchBar.vue";
import CoverImg from '@/components/templates/common/coverImg.vue';
import { mapState } from "vuex";
import { utilJs } from "@/utils/common.js";
import { BARGAIN_PROD_TYPE_MAP, SALES_PROD_TYPE_MAP, COLLAGE_PROD_TYPE_MAP, GROUP_PURCHASE_PROD_TYPE_MAP, MARKETING_TYPE_NAME_MAP, EQUAL_SCALE_IMG_TYPE } from "@/utils/constant.js";
let getType = 1;
let pageIndex = 1;
let flashCkFromToNew = {
  '5': global.ckFrom.flashSalesCourse,
  '7': global.ckFrom.activity,
  '9': global.ckFrom.flashSalesColumn,
  '1': global.ckFrom.flashSalesVip,
  '8': global.ckFrom.datum,
  '23': global.ckFrom.flashSalesSvip,
  '61': global.ckFrom.flashSalesCombo,
  '11': global.ckFrom.flashSalesExam,
  '51': global.ckFrom.flashSalesLive,
  '27': global.ckFrom.flashSalesPresentVip,
  '28': global.ckFrom.flashSalesPresentSvip,
  '41': global.ckFrom.flashSalesClockIn,
  '78': global.ckFrom.flashSalesCamp,
  '10': global.ckFrom.flashSalesSocial,
  '53': global.ckFrom.flashSalesReservation,
  '77': global.ckFrom.flashSalesVoiceTest,
  '75': global.ckFrom.flashSalesMutuaTest,
  '116': global.ckFrom.flashSalesEdu,
  '125': global.ckFrom.testpPaper,
  '129': global.ckFrom.itemBank,
  '142': global.ckFrom.flashSalesEbooks,
  '115': global.ckFrom.flashSalesPrivatclass
};
let presentType = {
  '5': global.ckFrom.presentCourse,
  '66': global.ckFrom.presentCourse,
  '9': global.ckFrom.presentColumn,
  '67': global.ckFrom.presentColumn,
  '61': global.ckFrom.presentPackage,
  '70': global.ckFrom.presentPackage,
  '78': global.ckFrom.presentCamp,
  '8076': global.ckFrom.presentCamp,
  '142': global.ckFrom.presentEbooks,
  '8083': global.ckFrom.presentEbooks,
}
const PRESENT_SRC_MAP = {
  300: '(赠品)实物带货',
  302: '(赠品)赠送礼包',
  303: '(赠品)支付有礼',
  304: '(赠品)满减送'
};
export default {
  name: "AllOrderList",
  components: {
    loadingStatusTem,
    MySmallTabbar,
    newSearchBar,
    VipCustomImg,
    CoverImg
  },
  props: [],
  data() {
    return {
      EQUAL_SCALE_IMG_TYPE: EQUAL_SCALE_IMG_TYPE,
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : "mb5_default",
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      orderStatus: {
        '-5': "已关闭",
        '-4': "删除订单",
        '-3': "已关闭",
        '-2': "已关闭",
        '-1': "交易关闭",
        0: "待付款",
        1: "待发货",
        2: "待收货",
        3: "已收货",
        5: "已退款",
        6: "退款失败"
      },
      dataStatus: 'HAS_MORE_DATA',
      type: -1,
      operationGoid: "",
      isToPay: false,
      tabList: [
        {index: -1, title: '全部'},
        {index: 0, title: '待付款'},
        {index: 1, title: '待发货'},
        {index: 2, title: '待收货'},
        {index: 3, title: '待评价'}
      ],
      showDialog: false,
      searchValue: '', // 搜素文字
      cfrom: global.ckFrom,
      isShowAddressInfo: false, // 是否显示地址
      currentConsigneeData: null,
      salesMap: Object.freeze(SALES_PROD_TYPE_MAP),
      bargainMap:  Object.freeze(BARGAIN_PROD_TYPE_MAP),
      collageMap: Object.freeze(COLLAGE_PROD_TYPE_MAP),
      groupPurchaseMap: Object.freeze(GROUP_PURCHASE_PROD_TYPE_MAP),
      typeMap: global.prodMapType,
      pathFrom: "",
      fromOrderType: '', // 2 只有商城订单数据
      orderVersion: localStorage.getItem("useOrderV24") == 'true' ? 2 : 1, //1 旧版 2 新版
      orderStatusV2: {
        0: '待付款',
        1: '待发货',
        2: '待收货',
        3: '已完成',
        4: '已关闭'
      },
      marketingmap: Object.freeze(MARKETING_TYPE_NAME_MAP),
    };
  },
  computed: {
    ...mapState({
      allOrderList: state => state.oem_store.allOrderList
    }),
    // 显示查看快递
    showConsigneeInfo() {
      return function(item) {
        return !this.isShowCollageInfo(item) &&
                ![9, 61, 78, 110, 111, 112].includes(item.orderDetail[0].prodType) &&
                [100, -300].includes(item.status) && item.consigneeInfo && (item.consigneeInfo.consigneeAddress != null || item.consigneeInfo.consigneeName != null || item.consigneeInfo.consigneePhone != null)
      }
    },
    // 显示是否预售退定金按钮
    isShowRefundBalance() {
      return function(item) {
        return item.presaleInfo.enableRefund == 1 && item.enableApplyRefund == 1 && !item.orderDetail.some(i => [100, 101, 102, 400].includes(i.afterSaleStatus))
      }
    },
    // 判断是否展示拼团信息
    isShowCollageInfo() {
      return function(item) {
        // 属于拼团 && 非商城拼团超过库存退款订单
        return item.collageInfo && item.tags.includes(2) && item.isCollage == 1 && item.collageStatus == 2 && !(item.orderSubType == 200 && item.status == -306)
      }
    },
    // 判断是否确认收货
    isShowComfirmReceipt() {
      return function(item) {
        return this.hasShoppingGoods(item) && item.pageStatus == 2 && item.fromApp != 10 && item.fromApp != 11;
      }
    },
    // 判断是否已发货
    isShowExpressStatus() {
      return function(item, cItem) {
        // 待发货状态 && 该已发货 && 属于拆分发货
        return this.hasShoppingGoods(item) && item.pageStatus == 1 && cItem.logiStatus == 2 && item.isSplitPackage == 1;
      };
    },
    showLogistics() {
      return function(item) {
        // 待收货、订单已完成 && (旧列表 || 新列表 && 物流状态发货/收货) && 快递中柚普通快递方式
        return ((this.orderVersion == 1 && [2, 3].includes(item.status)) || (this.orderVersion == 2 && [2, 3].includes(item.logiStatus) && [2, 3].includes(item.pageStatus))) && item.deliverTypeArr && item.deliverTypeArr.some(item => item == 1);

      }
    },
    // 获取尾款支付日期如下： 3月28日 9:30
    getLeaveTime() {
      return function(item) {
        let sTime = this.orderVersion == 1 ? item.leaveStartTime : item.presaleInfo.leaveStartTime;
        let eTime = this.orderVersion == 1 ? item.leaveEndTime : item.presaleInfo.leaveEndTime;
        // 尾款还未开始 尾款支付开始时间+开始支付尾款 尾款开始支付 尾款支付截至时间+前支付尾款
        if (sTime == null || eTime == null) return
        let leaveStartTime = new Date(sTime.replace(/-/g, "/"));
        let leaveEndTime = new Date(eTime.replace(/-/g, "/"));
        leaveEndTime = new Date(leaveEndTime.getTime() + 1000); // 前支付尾款 得加一秒 让展示更严谨
        if ((item.finalBalanceTimeStatus == 0 && this.orderVersion == 1) || (item.presaleInfo.finalBalanceTimeStatus == 0 && this.orderVersion == 2)) {
          return `${leaveStartTime.getMonth() + 1}月${leaveStartTime.getDate()}日 ${leaveStartTime.getHours() > 9 ? '' + leaveStartTime.getHours() : '0' + leaveStartTime.getHours()}:${leaveStartTime.getMinutes() > 9 ? '' + leaveStartTime.getMinutes() : '0' + leaveStartTime.getMinutes()}开始支付尾款`
        } else if ((item.finalBalanceTimeStatus == 1 && this.orderVersion == 1) || (item.presaleInfo.finalBalanceTimeStatus == 1 && this.orderVersion == 2)) {
          return `${leaveEndTime.getMonth() + 1}月${leaveEndTime.getDate()}日 ${leaveEndTime.getHours() > 9 ? '' + leaveEndTime.getHours() : '0' + leaveEndTime.getHours()}:${leaveEndTime.getMinutes() > 9 ? '' + leaveEndTime.getMinutes() : '0' + leaveEndTime.getMinutes()}前支付尾款`
        }
      }
    },
    // 判断是否展示售后文案
    isShowRefundTxt() {
      return function(item) {
        // 售后展示状态 && 非赠品 (200:退款成功 201/202:商家主动退款 203:预约师资-取消预约 205库存不足退款 204自动退款)
        return [100, 101, 102, 200, 201, 202, 203, 204, 205, 400].includes(item.afterSaleStatus) && !PRESENT_SRC_MAP[item.prodSrc];
      }
    },
    // 处理售后展示文案
    getAfterStatusTxt() {
      return function (item) {
        return [100, 101, 102, 400].includes(item.afterSaleStatus) ? '售后中' : '已退款';
      }
    },
    // 判断是否走商城商品订单流程
    hasShoppingGoods() {
      return function(item) {
        if (!item.orderDetail || !item.orderDetail.length) {
          return false;
        }
        //是商城订单 || 产品列表里有商城商品
        return item.orderSubType == 200 || item.orderDetail.some(i => i.prodType == global.ckFrom.shopping);
      }
    },
    // 是否展示删除订单按钮
    isShowDeleteOrder() {
      return function(item) {
        // 商城订单 && 交易关闭 && 非预售超出尾款支付时间 && 非已退款订单 status == -300
        return [-100, -102, -303, -302].includes(item.status) && !(item.presaleInfo && item.presaleInfo.finalBalanceTimeStatus == 2) && this.hasShoppingGoods(item)
      }
    }
  },
  watch: {
    $route(to, from) {
      let queryOrderType = this.$route.query.orderType;
      queryOrderType = (queryOrderType === 0 || queryOrderType === '0') ? 0 : (queryOrderType || -1);
      if (this.orderVersion == 2) {
        return;
      }
      if ((from.path == '/mall/shopSettlement/shopSettlement' || from.path == '/member/memberIndex' || from.path == '/homePage/live/liveVHRoom' || from.path == '/homePage/live/liveRoom' || from.path == '/homePage/live/liveVerticalRoom' || (from.path == '/mall/mallOrder/orderDetail' && sessionStorage.getItem('isGiftOrderPay')) || from.path == '/homePage/course/aliPayMiddlePage') && to.path == '/member/myOrder/allOrderList') { // 页面缓存情况下，当订单到结算页后再进入该页面重新加载列表
        if (sessionStorage.getItem('isGiftOrderPay')) {
          sessionStorage.removeItem("isGiftOrderPay");
        }
        this.type = Number(queryOrderType);
        this.searchValue = '';
        this.initData();
      }
      if ((from.path == '/member/myOrder/knowledgeOrderDetail' || from.path == '/mall/mallOrder/orderDetail' || from.path == '/mall/shopComments/addShopComment' || sessionStorage.getItem('filterOrderId')) && sessionStorage.getItem('filterOrder')) {
        let orderId = ''
        let index = 0;
        if (from.path == '/member/myOrder/knowledgeOrderDetail' || sessionStorage.getItem('filterOrderId')) {
          orderId = from.query.orderId || sessionStorage.getItem('filterOrderId');
          index = this.allOrderList.findIndex(item => item.orderId == orderId);
          if (sessionStorage.getItem('filterOrderId')) {
            sessionStorage.removeItem('filterOrderId');
          }
        } else {
          orderId = from.query.goId;
          index = this.allOrderList.findIndex(item => (this.orderType == 1 ? item.goId : item.orderId) == orderId);
        }
        if (this.dataStatus == "HAS_MORE_DATA") {
          getType = 2;
          // this.getOrderList(index);
          if (this.orderVersion == 1) {
            this.getOrderList(index);
          } else {
            this.getOrderListV2(index);
          }
          sessionStorage.removeItem('filterOrder')
        }
      }
      if (from.path == '/member/memberIndex' || from.path == '/homePage/live/liveVHRoom' || from.path == '/homePage/live/liveRoom' || from.path == '/homePage/live/liveVerticalRoom') {
         this.type = Number(queryOrderType);
      }
    },
    allOrderList() {
      if (this.allOrderList.length == 0) {
        this.dataStatus = "NO_DATA"
      }
    }
  },
  beforeRouteEnter(to, from, next) {
    next(vm => {
      vm.pathFrom = from.path;
      if (vm.orderVersion == 2) {
        return;
      }
      // 订单超过24小时未支付会生成新订单，此时要替换详情、列表的orderId，否则返回会报错
      if ((from.path == '/homePage/course/coursePay' || from.path == '/homePage/payPolitely/payPolitely') && sessionStorage.getItem('orderMergeId')) {
        let orderMergeId = sessionStorage.getItem('orderMergeId');
        vm.setOrderListAttribute(vm.$route.query.orderId, 'orderId', orderMergeId);
        sessionStorage.removeItem('orderMerge');
      }
    });
  },
  beforeRouteLeave(to, from, next) {
    this.$cjConfirm.hide();
    next();
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() { },
  methods: {
    /**从其他页面返回订单列表页的数据更新机制处理---START--- */
    //检查状态管理器的订单是否发生了变更，对比现在的订单信息
    checkOrderStatusByNo() {
      let checkOrderNo = this.$store.state.oem_store.orderDetailNo;
      this.$store.commit('updateOrderDetailNo', '');
      //如果订单不存在，则不需要对比，直接刷新列表
      if (!checkOrderNo) {
        this.type = -1;
        this.searchValue = '';
        this.initData();
        return;
      }
      console.log('无刷新列表');
      this.getOrderInfoByOrderNo(checkOrderNo);
    },
    //获取指定订单no对应的订单信息
    getOrderInfoByOrderNo(checkOrderNo) {
      let url = `${global.apiurl}aggOrder/getAggOrderList?page=1&status=${this.type}&searchName=${this.searchValue}&orderNo=${checkOrderNo}`;
      if (this.fromOrderType) {
        url = `${url}&fromOrderType=${this.fromOrderType}`;
      }
      utilJs.getMethod(url, res => {
         let list = res.data || [];
         let updateOrderInfo = list.find(i => i.orderNo == checkOrderNo);
         //查看新返回的订单列表的这个订单数据存不存在，如果不存在，则直接重置刷新整个订单列表
         if (!updateOrderInfo) {
          this.type = -1;
          this.searchValue = '';
          this.initData();
          return;
         }
         let curIndex = this.allOrderList.findIndex(i => i.orderNo == checkOrderNo);
         if (curIndex == -1) {
          return;
         }
         let curOrderInfo = this.allOrderList[curIndex]
         let isSome = JSON.stringify(updateOrderInfo) == JSON.stringify(curOrderInfo);
         //如果信息相等，说明没变化，不需要处理啥
         if (isSome) {
           return;
         }
         this.setPriceHtml(updateOrderInfo);
         //不相等，说明变化了，直接替换掉旧的数据
         this.$set(this.allOrderList, curIndex, updateOrderInfo)
      })
    },
    /**从其他页面返回订单列表页的数据更新机制处理---END--- */
    getProdCover(item) {
      let cover = item.prodCover;
      //vip图片封面处理
      if (item.prodType == global.ckFrom.vip) {
        cover = (item.prodCover.coverType == 2 && item.prodCover.coverUrl) || '';
      }
      //svip图片封面处理
      if (item.prodType == global.ckFrom.svip) {
        cover = (item.prodCover.coverType == 2 && item.prodCover.coverUrl) || '';
      }
      return cover;
    },
    // 获取产品类型
    getProdTypeText(item) {
      let text = this.typeMap[item.prodType];
      if (item.prodType == 201) {
        text = '测评报告'
      }
      if (item.prodType == 185) {
        text = '圈子主题'
      }
      if (item.prodType == 11) {
        text = '测评专题'
      }
      if (item.prodType == 200) {
        text = '代金券'
      }
      return text;
    },
    getIsShowPrice(item, cItem) {
      if (item.tags.includes(134217728) && item.prodsCollocation && item.prodsCollocation.isShowPrice == 0)
        return false;
      return true;
    },
    isShowGift(item) {
      // 订单状态status: 0 未支付  1已支付 -1支付失败，-2取消订单  -3 退款 -4 订单超时（不在订单列表显示，真删除） -6:订单手动退款 -7手动退款失败, -8 超时关闭订单（系统根据配置时间主动关闭,在订单列表显示)
      // isDeprecated（是否全部废弃）目前只有活动用到，取非不影响其他类型产品的判断
      // 有礼包（isGiftRelate） && 没有全部废弃（isDeprecated true票券全废弃）&& (status:  1交易成功 || -3 签到退款也需要展示礼包)
      return item.isGiftRelate && !item.isDeprecated && (item.status == -3 || item.status == 1)
    },
    finishFn(item) {
      let url = `${global.apiurl}aggOrder/getAggOrderList?page=1&status=${this.type}&searchName=${this.searchValue}&orderNo=${item.orderNo}`;
      if (this.fromOrderType) {
        url = `${url}&fromOrderType=${this.fromOrderType}`;
      }
      utilJs.getMethod(url, res => {
         let list = res.data || [];
         let updateOrderInfo = list.find(i => i.orderNo == item.orderNo);
         if (!updateOrderInfo) {
          return;
         }
         let curIndex = this.allOrderList.findIndex(i => i.orderNo == item.orderNo);
         if (curIndex == -1) {
          return;
         }
         this.$set(this.allOrderList, curIndex, updateOrderInfo)
      })
    },
    openGifts(item) {
      this.$routerGo(this, "push", {
        path: `/activity/myTicket?activityId=${this.orderVersion == 1 ? item.activityId : item.activityEnroll.activityId}&identCode=${this.orderVersion == 1 ? item.identCode : item.activityEnroll.identCode}&asId=${0}`
      });
    },
    // 票券信息
    toTickInfo(item) {
      // 点击查看票券
      this.$routerGo(this, "push", {
        path: `/activity/myTicket`,
        query: {
          activityId: this.orderVersion == 1 ? item.activityId : item.activityEnroll.activityId,
          identCode: this.orderVersion == 1 ? item.identCode : item.activityEnroll.identCode,
          asId: 0
        }
      });
    },
    goCollageDetail(item) {
      let query = null
      if (item.orderSubType == 200) {
        // 商城订单
        query = {isMall: 1, orderId: item.orderId}
      } else {
        // 知识产品
        query = {collageId: item.collageInfo.collageId, groupId: item.collageInfo.groupId}
      }
      this.$routerGo(this, "push", {
        path: "/homePage/collage/collageDetail",
        query: query
      });
    },
    goMyBooking() {
      this.$routerGo(this, "push", {
        path: "/member/myBooking/myBookingList",
        query: {isFromOrder: 1}
      });
    },
    goApplyRefund(item) {
      if (item == null) return
      let goodInfo = item.orderDetail[0];
      this.$routerGo(this, "push", {
        path: '/mall/mallOrder/applyRefund',
        query: ({godId: goodInfo.godId, type: 1, refundReason: 13})
      })
      return
    },
    //企业团购票券
    goGroupPurchaseTicket(gOrderId) {
      this.$routerGo(this, "push", {path: '/homePage/groupPurchase/groupPurchaseMyTicket', query: {orderId: gOrderId}});
    },
    // 查看快递信息
    checkConsigneeInfo(item) {
      if (this.orderVersion == 1) {
        this.currentConsigneeData = {};
        this.currentConsigneeData.consigneeName = item.consigneeName;
        this.currentConsigneeData.consigneePhone = item.consigneePhone;
        this.currentConsigneeData.consigneeAddress = item.consigneeAddress;
        this.currentConsigneeData.expressName = item.expressName;
        this.currentConsigneeData.expressNumber = item.expressNumber;
        this.currentConsigneeData.consigneeArea = item.consigneeArea;
        this.isShowAddressInfo = true;
      } else {
        this.currentConsigneeData = {};
        this.currentConsigneeData.consigneeName = item.consigneeInfo.consigneeName;
        this.currentConsigneeData.consigneePhone = item.consigneeInfo.consigneePhone;
        this.currentConsigneeData.consigneeAddress = item.consigneeInfo.consigneeAddress;
        this.currentConsigneeData.expressName = item.consigneeInfo.expressName;
        this.currentConsigneeData.expressNumber = item.consigneeInfo.expressNumber;
        this.currentConsigneeData.consigneeArea = item.consigneeInfo.consigneeArea;
        this.isShowAddressInfo = true;
      }
    },
    // 修改地址
    handleClickAddress(goId) {
      this.$routerGo(this, "push", {
        path: "/mall/mallOrder/orderAddress",
        query: ({
          goId: goId
        })
      });
    },
    // 关闭支付有礼弹窗
    handleClickCloseDialog() {
      this.showDialog = false;
    },
    // 评论操作
    goComments(item) {
      this.$routerGo(this, "push", {
        path: this.type == -1 ? '/mall/shopComments/addShopComment' : '/mall/shopComments/addShopComment?orderType=' + this.type,
        query: ({
          goId: this.orderVersion == 1 ? item.goId : item.haveGiftMallProd ? item.goId : item.orderId,
          type: 1 // 1添加订单评论
        })
      })
    },
    // 跳转到已评价页面
    goToCommentList() {
      this.$routerGo(this, "push", {
        path: "/mall/shopComments/shopCommentList",
        query: {
          type: 2
        }
      });
    },
    changeType: function (type) {
      this.type = type;
      this.isToPay = type == 0 ? true : false;
      pageIndex = 1;
      this.dataStatus = "HAS_MORE_DATA"
      this.allOrderList = [];
      this.$store.commit('updateAllOrderList', []);
      // this.getOrderList();
      if (this.orderVersion == 1) {
        this.getOrderList();
      } else {
        this.getOrderListV2();
      }
    },
    //查看物流
    clickLogistics(index, isSplitPackage, goId) {
      this.$routerGo(this, "push", {
        path: '/mall/shippingAddress/addressList',
        query: {fromOrderDetail: 1, goId: goId}
      })
    },
    //确认收货
    clickConfirmReceipt(item) {
      let hasGorId = false;
      let goId = this.orderVersion == 1 ? item.goId : item.haveGiftMallProd == 1 ? item.goId : item.orderId;
      if (item.orderDetail && item.orderDetail.length > 0) {
        item.orderDetail.forEach((item) => {
          if (item.afterStatus == 1) {
            hasGorId = true;
          }
        })
      }
      this.operationGoid = goId;
      let that = this;
      that.$cjConfirm({
        title: hasGorId ? '该订单中存在退款中的商品，确认收货将关闭退款' : '确认收货', //
        titleCenter: true, //标题是否居中
        message: '',
        messageCenter: true, //内容是否居中
        showMasker: true, //是否显示透明背景
        clickCloseModal: false, //是否点击透明背景关闭弹窗
        showCancelButton: true, //是否显示取消按钮
        cancelButtonText: '取消', //取消按钮文本
        confirmButtonText: '确定', //确认按钮文本
        onConfirm() {
          that.orderHandle(3)
        },
        onCancel() {
        },
      })
    },
    // 局部更新订单详情页面数据
    partUpateOrder(operactionInfo) {
      if (operactionInfo == null) {
        return
      }
      if (operactionInfo.operaction == 'editAddress') {
        // 不展示修改地址
        this.setOrderListAttribute(operactionInfo.goId, 'updateAddressTime', 1);
      } else if (operactionInfo.operaction == 'receiveOrder') {
        // 确认收货
        this.setOrderListAttribute(operactionInfo.goId, 'pageStatus', 3);
        this.setOrderListAttribute(operactionInfo.goId, 'logiStatus', 3);
        // 当页面在待收货的tab页面
        if (this.type == 2) {
          this.filterOrderList(operactionInfo);
        }
      } else if (operactionInfo.operaction == 'deleteOrder') {
        // 删除订单
        this.filterOrderList(operactionInfo);
      } else if (operactionInfo.operaction == 'cancelOrder') {
        // 取消订单
        if (this.orderVersion == 1) {
          this.setOrderListAttribute(operactionInfo.goId, 'status', -5);
        } else {
          this.setOrderListAttribute(operactionInfo.goId, 'status', -102);
          this.setOrderListAttribute(operactionInfo.goId, 'pageStatus', 4);
        }
        // 当页面在待付款的tab页面
        if (this.type == 0) {
          this.filterOrderList(operactionInfo);
        }
      }
    },
    // 设置订单的属性
    setOrderListAttribute(goId, name, value) {
      let allOrderList = this.allOrderList;
      let index = allOrderList.findIndex(item => item.goId == goId);
      allOrderList.forEach(item => {
        this.$set(allOrderList[index], name, value)
      })
      this.$store.commit('updateAllOrderList', allOrderList);
    },
    // 过滤订单
    filterOrderList (operactionInfo) {
      let allOrderList = this.allOrderList;
      let list = [];
      let index = 0;
      if ((!operactionInfo.fromOrderType || operactionInfo.fromOrderType == 2) && this.orderVersion == 1) {
        list = allOrderList.filter(item => item.goId != operactionInfo.goId);
        index = allOrderList.findIndex(item => item.goId == operactionInfo.goId);
      } else {
        if (operactionInfo.orderId) {
          list = allOrderList.filter(item => item.orderId != operactionInfo.orderId);
          index = allOrderList.findIndex(item => item.orderId == operactionInfo.orderId);
        } else {
          list = allOrderList.filter(item => item.orderNo != operactionInfo.orderNo);
          index = allOrderList.findIndex(item => item.orderNo == operactionInfo.orderNo);
        }
      }
      this.$store.commit('updateAllOrderList', list);
      if (this.dataStatus == "HAS_MORE_DATA") {
        getType = 2;
        // this.getOrderList(index);
        if (this.orderVersion == 1) {
          this.getOrderList(index);
        } else {
          this.getOrderListV2(index);
        }
      }
    },
    //点击取消订单
    clickCancelOrder(goId, status) {
      this.operationGoid = goId;
      let that = this;
      if (status == 2) { // 取消订单弹窗展示
        that.$cjConfirm({
          title: '确认取消该订单', //
          titleCenter: true, //标题是否居中
          message: '',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: true, //是否显示取消按钮
          cancelButtonText: '取消', //取消按钮文本
          confirmButtonText: '确定', //确认按钮文本
          onConfirm() {
            that.orderHandle(-2)
          },
          onCancel() {
          },
        })
      } else { // 删除订单
        that.$cjConfirm({
          title: '确定要删除该订单', //
          titleCenter: true, //标题是否居中
          message: '',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: true, //是否显示取消按钮
          cancelButtonText: '', //取消按钮文本
          confirmButtonText: '', //确认按钮文本
          onConfirm() {
            utilJs.getMethod(
              global.apiurl + "goodsOrders/deleteClosedOrder/" + goId, (res) => {
                that.$showCjToast({
                  text: res,
                  type: "success",
                  time: 1000
                });
                let operactionInfo = {
                  goId: goId,
                  operaction: 'deleteOrder'
                }
                if (that.orderVersion == 2) {
                  operactionInfo.orderId = goId
                }
                that.partUpateOrder(operactionInfo);
              }
            )
          },
          onCancel() {
          },
        })
      }
    },
    //操作订单
    orderHandle(status) {
      utilJs.postMethod(
        global.apiurl + "goodsOrders/orderHandle",
        {
          status: status,
          goId: this.operationGoid
        },
        res => {
          this.$showCjToast({
            text: status == -2 ? "订单已取消" : res,
            type: "success",
            time: 1500
          });
          if (status == -2) { // 取消订单
            let operactionInfo = {
              goId: this.operationGoid,
              operaction: 'cancelOrder'
            }
            this.partUpateOrder(operactionInfo);
          } else if (status == 3) { // 确认收货
            let operactionInfo = {
              goId: this.operationGoid,
              operaction: 'receiveOrder'
            }
            this.partUpateOrder(operactionInfo);
          }
        }
      );
    },
    clickGoShop(shopNo) {
      this.$routerGo(this, "push", {
        path: "/mall/shopDetail/shopDetail",
        query: { shopNo: shopNo }
      });
    },
    clickPay(gItem) {
      // 定金已付尾款支付未到时间 不跳转 但是定金待付款 和普通订单待付款可以跳转
      if (gItem.presaleInfo && gItem.presaleInfo.finalBalanceTimeStatus == 0 && ((gItem.status == 1 && this.orderVersion == 1) || (gItem.status == 200 && this.orderVersion == 2))) return
      let goPathg = '';
      if ((gItem.fromOrderType == 2 && this.orderVersion == 1) || (gItem.orderDetail[0].prodType == this.cfrom.shopping && this.orderVersion == 2)) {
        goPathg = gItem.collageId
          ? "/mall/mallOrder/orderDetail?goId=" + (this.orderVersion == 1 ? gItem.goId : gItem.orderId) + "&orderNo=" + gItem.orderNo + "&collageId=" + gItem.collageId + "&type=" + this.type
          : "/mall/mallOrder/orderDetail?goId=" + (this.orderVersion == 1 ? gItem.goId : gItem.orderId) + "&orderNo=" + gItem.orderNo + "&type=" + this.type;
      } else {
        goPathg = `/member/myOrder/knowledgeOrderDetail?orderId=${gItem.orderId}&orderNo=${gItem.orderNo}&tabIndex=${this.type}`;
      }
      this.$routerGo(this, "push", {
        path: goPathg
      });
    },
    // 价格样式分割
    priceStyleChange(price) {
      if (price == 'free') { //实际付款价格允许显示0.00
        price = '0.00'
      } else {
        price = (price * 1 + 0.00000001).toFixed(2); // 防止字段传number型数据
      }
      if ((price * 1) == 0) {
        return price;
      }
      let splitPrice = (price.toString().replace(/-/g, '')).split('.')
      let afterPrice = `${splitPrice[0]}.<span class="c-fs20">${splitPrice[1]}</span>`;
      return afterPrice;
    },
    // v-html赋值
    setPriceHtml(item) {
      item.postage = (item.postage && item.postage * 1 > 0) ? this.priceStyleChange(item.postage) : this.priceStyleChange('0.00');
      item.totalDiscountPrice = (item.totalDiscountPrice && item.totalDiscountPrice * 1 != 0) ? this.priceStyleChange(item.totalDiscountPrice) : this.priceStyleChange('0.00');
      item.payMoney = (item.payMoney && item.payMoney * 1 > 0) ? this.priceStyleChange(item.payMoney) : this.priceStyleChange('free');
    },
    //获取订单列表
    getOrderList(index) {
      if (getType == 2 && index == undefined) {
        getType = 1;
        return
      }
      this.$loading.show();
      if (getType == 1) {
        if (this.dataStatus == 'LOADING') {
          return;
        }
        this.dataStatus = 'LOADING';
      }
      let t = this.type == -1 ? '' : this.type;
      let page = getType == 2 ? parseInt(index / 10) + 1 : pageIndex;
      utilJs.getMethod(global.apiurl + "goodsOrders/allOrderList?page=" + page + "&status=" + t + "&searchName=" + this.searchValue + (this.fromOrderType ? '&fromOrderType=' + this.fromOrderType : ''),
        res => {
          let allOrderList = this.allOrderList;
          let list = res.list || [];
          if (getType == 1) {
            list.forEach((item, index) => {
              if (flashCkFromToNew[item.prodType] && item.tags == 8) {
                item.realProdType = flashCkFromToNew[item.prodType]; //跳转到支付页面的时候ckfrom用这个realProdType
              } else {
                item.realProdType = item.prodType;
              }
            })
            if (pageIndex == 1) {
              allOrderList = list;
              allOrderList.forEach((item, index) => {
                item.totalDiscountPrice * 1 > 0 ? allOrderList[index].totalDiscountSign = 1 : allOrderList[index].totalDiscountSign = 0;
                this.setPriceHtml(item);
              })
            } else {
              list.forEach((item, index) => {
                item.totalDiscountPrice * 1 > 0 ? list[index].totalDiscountSign = 1 : list[index].totalDiscountSign = 0;
                this.setPriceHtml(item);
              })
              allOrderList = [...allOrderList, ...list];
            }
            if (allOrderList.length == res.total) {
              this.dataStatus = allOrderList.length == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
            } else {
              this.dataStatus = 'HAS_MORE_DATA';
              pageIndex++;
            }
            this.$store.commit('updateAllOrderList', allOrderList);
          } else {
            let item = list[list.length - 1];
            allOrderList.push(item);
            this.$store.commit('updateAllOrderList', allOrderList);
            getType = 1;
          }
          this.$loading.hide();
        },
        failRes => {
          this.dataStatus = 'DATA_ERROR';
          this.$loading.hide();
        }
      );
    },
    // 点击取消知识产品
    clickCancelKnowledgeOrder(orderId, orderNo) {
      let that = this;
      that.$cjConfirm({
          title: '确认取消该订单', //
          titleCenter: true, //标题是否居中
          message: '',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: true, //是否显示取消按钮
          cancelButtonText: '取消', //取消按钮文本
          confirmButtonText: '确定', //确认按钮文本
          onConfirm() {
            that.cancelKnowledgeOrder(orderId, orderNo);
          },
          onCancel() {
          },
        })
    },
    // 取消知识产品订单
    cancelKnowledgeOrder(orderId, orderNo) {
      let that = this;
      utilJs.postMethod(
        global.apiurl + "orders/orderCancel",
        { orderId: orderId, orderNo: orderNo }, res => {
          if (res == "OK") {
            // 成功改变状态
            that.$showCjToast({
              text: "取消成功",
              type: "success",
            });
            // 需要再次对接id
            let operactionInfo = {
              orderId: orderId,
              operaction: 'deleteOrder',
              fromOrderType: 1,
              orderNo: orderNo
            }
            that.partUpateOrder(operactionInfo);
          }
        }
      );
    },
    //点击订单 prodType 2升级vip，4升级svip，22购买vip2，38专栏兑换码
    clickOrderItem(item) {
      if ((item.fromOrderType == 1 && this.orderVersion == 1) || (item.orderDetail[0].prodType != this.cfrom.shopping && this.orderVersion == 2)) {
        if ((!item.orderId && this.orderVersion == 1) || (!item.orderNo && this.orderVersion == 2)) {
          this.$showCjToast({
              text: "此订单已不存在",
              type: "warn",
          })
          return
        }
        this.$routerGo(this, "push", {
          path: '/member/myOrder/knowledgeOrderDetail',
          query: {
            orderId: item.orderId,
            tabIndex: this.type,
            orderNo: item.orderNo
          }
        })
      } else {
        this.$routerGo(this, "push", {
          path: '/mall/mallOrder/orderDetail',
          query: {
            goId: this.orderVersion == 1 ? item.goId : item.orderId,
            type: this.type,
            orderNo: item.orderNo
          }
        })
      }
    },
    // 新列表支付参数判断
    clickListPay(index) {
      let item = this.allOrderList[index].orderDetail[0];
      item.tags = this.allOrderList[index].tags;
      item.orderId = this.allOrderList[index].orderId;
      item.extId = this.allOrderList[index].extId;
      item.realProdType = this.allOrderList[index].tags.includes(8) ? (item.prodType == 110 || item.prodType == 111 || item.prodType == 112 ? flashCkFromToNew[5] : flashCkFromToNew[item.prodType]) : (item.prodType == 110 || item.prodType == 111 || item.prodType == 112 ? 5 : item.prodType);
      item.courseType = item.courseType == 110 ? 0 : item.courseType == 111 ? 1 : item.courseType == 112 ? 2 : '';
      console.log('zzzzz', item)
      // 判断体验版是否到期，到期之后不可购买商品
      if (utilJs.alertShopExpire(this, utilJs.getTimeByDate(this.companyAuth.expireTime))) return true;
      if (!utilJs.isOpenIosGzhPay(item.prodType)) {
        this.$store.commit('updateShowVitualModal', true);
        return;
      }
      switch (item.realProdType) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 22:
        case 23:
        case 27:
        case 28:
        case 73:
        case 74:
          let queryObj = {
            prodId: item.prodId,
            type: item.prodType,
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.tags.includes(4096)) {
            // 判断当前是砍价购得vip跳转携带参数
            queryObj.attendId = item.extId;
          } else if (item.tags.includes(4194304)) {
            queryObj.recRelateId = item.extId;
            queryObj.recType = 3
          } else {
            queryObj.pId = item.extId;
            queryObj.isFrom = 0;
          }
          if (item.tags.includes(1048576)) { //企业团购
            queryObj.isFrom = 4;
            queryObj.isFromGroupOrder = true;
            queryObj.quantity = item.quantity;
          }
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: queryObj
          });
          break;
        // 训练营
        case 78:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType,
              isFromInvite: 0,
              isFromOrder: "TRUE",
              attendId: item.tags.includes(4096) ? item.extId : '',
              recRelateId: item.tags.includes(4194304) ? item.extId : '',
              recType: item.tags.includes(4194304) ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 5:
        case 25:
          let pathQuery = {
            cId: item.prodId,
            courseType: item.courseType,
            extId: -1,
            ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType, // 活动进入支付页面
            isFromInvite: item.isDeductedByInvitationCard,
            isFromOrder: "TRUE",
            attendId: item.tags.includes(4096) ? item.extId : '',
            recRelateId: item.tags.includes(4194304) ? item.extId : '',
            recType: item.tags.includes(4194304) ? 3 : '',
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.tags.includes(1048576)) { //企业团购
            pathQuery.isGroupPurchase = true;
            pathQuery.groupSelectNum = item.quantity;
            pathQuery.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: pathQuery
          });
          break;
        case 66:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.prodId,
              extId: -1,
              ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType, // 活动进入支付页面
              isFromInvite: item.isDeductedByInvitationCard,
              isFromOrder: "TRUE",
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 29:
        case 30:
        case 104:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.extId,
              extId: item.collageId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              prodId: item.prodId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 51:
        case 41:
        case 115:
        case 180:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              attendId: item.tags.includes(4096) ? item.extId : '',
              recRelateId: item.tags.includes(4194304) ? item.extId : '',
              recType: item.tags.includes(4194304) ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 7:
          let activityEnroll = this.allOrderList[index].activityEnroll
          localStorage.setItem(
            "activityEnrollInfo",
            JSON.stringify({
              activityId: activityEnroll.activityId,
              actTicketId: activityEnroll.actTicketId,
              infoArr: activityEnroll.unPayInfo ? activityEnroll.unPayInfo.infoArr : '',
              identCode: activityEnroll.unPayInfo ? activityEnroll.unPayInfo.identCode : '',
            })
          );
          let queryAc = {
            cId: -1,
            selectNum: item.quantity,
            activityId: activityEnroll.activityId,
            extId: item.prodId,
            ckFrom: item.realProdType, // 活动进入支付页面
            isFromInvite: item.prodType == 9 ? item.isDeductedByInvitationCard : 0,
            isFromOrder: "TRUE",
            attendId: item.tags.includes(4096) ? item.extId : '',
            recRelateId: item.tags.includes(4194304) ? item.extId : '',
            recType: item.tags.includes(4194304) ? 3 : '',
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.mtkType == 1 || item.tags.includes(8)) {
            queryAc.pId = item.extId;
          }

          if (item.tags.includes(1048576)) { //企业团购
            queryAc.isGroupPurchase = true;
            queryAc.groupSelectNum = item.quantity;
            queryAc.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryAc
          });
          break;
        case 6:
        case 8:
        case 9:
        case 10:
        case 11:
        case 26:
        case 56:
        case 61:
        case 62:
        case 75:
        case 77:
        case 103:
          let queryT = {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType, // 活动进入支付页面
              isFromInvite: item.prodType == 9 ? item.isDeductedByInvitationCard : 0,
              isFromOrder: "TRUE",
              attendId: item.tags.includes(4096) ? item.extId : '',
              recRelateId: item.tags.includes(4194304) ? item.extId : '',
              recType: item.tags.includes(4194304) ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          if (item.realProdType == 8 && item.tags.includes(8)) {
            queryT.pId = item.extId;
          }
          if (item.tags.includes(1048576)) { //企业团购
            queryT.isGroupPurchase = true;
            queryT.groupSelectNum = item.quantity;
            queryT.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryT
          });
          break;
        case 67:
        case 70:
        case 71:
        case 72:
        case 8075:
        case 8076:
        case 8077:
        case 8078:
        case 8079:
        case 8080:
        case 8083:
        case 8084:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 15:
        case 17:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 问答进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 68:
        case 69:
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: {
              type: item.realProdType,
              prodId: item.prodId,
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 116:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType,
              jwSaleCourseSpecId: item.extId,
              studentId: this.allOrderList[index].extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 8082:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.prodType,
              jwSaleCourseSpecId: item.extId,
              studentId: this.allOrderList[index].extId,
              pId: item.jwMarketingId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 129:
        case 125:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              extId: item.prodId,
              ckFrom: item.prodType,
              isFromInvite: 0,
              cId: -1,
              isFromOrder: "TRUE",
              pId: (item.tags.includes(8) || item.tags.includes(12)) ? item.extId : '',
              attendId: item.tags.includes(4096) ? item.extId : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 142:
        case 145:
        case 146:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: 0,
              extId: (item.tags.includes(2) || item.tags.includes(8) || item.tags.includes(4096)) ? item.prodId : item.extId,
              ckFrom: item.tags.includes(4) ? presentType[item.realProdType] : item.realProdType,
              extraId: 0,
              attendId: item.tags.includes(4096) ? item.extId : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          })
          break;
        case 181:
        case 185:
        case 5000:
          let query = {
            cId: 0,
            extId: item.extId || item.prodId,
            ckFrom: item.realProdType,
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.spec) {
            query.circleSpecDateType = item.spec.type;
            query.circleSpecDateVal = item.spec.val;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: query
          })
          break;
        case 190:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.prodId || 0,
              extId: 0,
              ckFrom: item.realProdType,
              orderId: item.orderId,
              tabIndex: this.type
            }
          })
          break;
        case 200:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType,
              rcdId: !!item.rcdId ? item.rcdId : '',
              number: 1,
            }
          });
          break;
        case 197:
          if (this.allOrderList[index].prodsCollocation.specType == 2) {
            let multipleTmp = {
              name: this.allOrderList[index].prodsCollocation.specName,
              id: this.allOrderList[index].extId,
              prods: this.allOrderList[index].prodsCollocation.subOrder,
            }
            localStorage.setItem("collocationProds", JSON.stringify(multipleTmp));
          } else {
            localStorage.setItem("collocationProds", JSON.stringify(this.allOrderList[index].prodsCollocation.subOrder));
          }
          let queryData = {
            cId: -1,
            extId: item.prodId,
            ckFrom: item.realProdType,
            orderId: item.orderId,
            comboType: this.allOrderList[index].prodsCollocation.comboType,
            isFromOrder: "TRUE"
          }
          if (this.allOrderList[index].prodsCollocation.specType == 2) {
            queryData.isMultiple = 1
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryData
          });
          break;
        case 86:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType
            }
          });
          break;
        case 53: // 约课
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              ckFrom: item.realProdType,
              extId: item.prodId,
              prodId: item.prodId,
              tabIndex: this.type,
            }
          });
          break;
      }
    },
    // 旧列表支付
    toPay(index) {
      let item = this.allOrderList[index];
      // 判断体验版是否到期，到期之后不可购买商品
      if (utilJs.alertShopExpire(this, utilJs.getTimeByDate(this.companyAuth.expireTime))) return true;
      if (!utilJs.isOpenIosGzhPay(item.prodType)) {
        this.$store.commit('updateShowVitualModal', true);
        return;
      }
      switch (item.realProdType) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 22:
        case 23:
        case 27:
        case 28:
        case 73:
        case 74:
          let queryObj = '';
          if (item.tags == '4096') {
            // 判断当前是砍价购得vip跳转携带参数
            queryObj = {
              prodId: item.prodId,
              type: item.prodType,
              attendId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          } else if (item.tags == '4194304') {
            queryObj = {
              prodId: item.prodId,
              type: item.prodType,
              orderId: item.orderId,
              tabIndex: this.type,
              recRelateId: item.extId,
              recType: 3
            }
          } else {
            queryObj = {
              type: item.prodType,
              prodId: item.prodId,
              pId: item.extId,
              orderId: item.orderId,
              isFrom: 0,
              tabIndex: this.type
            };
          }
          if ((item.tags & 1048576) == 1048576) { //企业团购
            queryObj.isFrom = 4;
            queryObj.isFromGroupOrder = true;
            queryObj.quantity = item.quantity;
          }
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: queryObj
          });
          break;
        // 训练营
        case 78:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType,
              isFromInvite: 0,
              isFromOrder: "TRUE",
              attendId: item.tags == '4096' ? item.extId : '',
              recRelateId: item.tags == '4194304' ? item.extId : '',
              recType: item.tags == '4194304' ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 5:
        case 25:
          let pathQuery = {
            cId: item.prodId,
            courseType: item.courseType,
            extId: -1,
            ckFrom: item.realProdType, // 活动进入支付页面
            isFromInvite: item.isDeductedByInvitationCard,
            isFromOrder: "TRUE",
            attendId: item.tags == '4096' ? item.extId : '',
            recRelateId: item.tags == '4194304' ? item.extId : '',
            recType: item.tags == '4194304' ? 3 : '',
            orderId: item.orderId,
            tabIndex: this.type
          }
          if ((item.tags & 1048576) == 1048576) { //企业团购
            pathQuery.isGroupPurchase = true;
            pathQuery.groupSelectNum = item.quantity;
            pathQuery.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: pathQuery
          });
          break;
        case 66:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.prodId,
              extId: -1,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: item.isDeductedByInvitationCard,
              isFromOrder: "TRUE",
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 29:
        case 30:
        case 104:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.extId,
              extId: item.collageId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              prodId: item.prodId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 51:
        case 41:
        case 115:
        case 180:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              attendId: item.tags == '4096' ? item.extId : '',
              recRelateId: item.tags == '4194304' ? item.extId : '',
              recType: item.tags == '4194304' ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 7:
          localStorage.setItem(
            "activityEnrollInfo",
            JSON.stringify({
              activityId: item.activityId,
              actTicketId: item.actTicketId,
              infoArr: item.unPayInfo.infoArr,
              identCode: item.unPayInfo.identCode
            })
          );
          let queryAc = {
            cId: -1,
            selectNum: item.quantity,
            activityId: item.activityId,
            extId: item.prodId,
            ckFrom: item.realProdType, // 活动进入支付页面
            isFromInvite: item.prodType == 9 ? item.isDeductedByInvitationCard : 0,
            isFromOrder: "TRUE",
            attendId: item.tags == '4096' ? item.extId : '',
            recRelateId: item.tags == '4194304' ? item.extId : '',
            recType: item.tags == '4194304' ? 3 : '',
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.mtkType == 1) {
            queryAc.pId = item.extId;
          }

          if ((item.tags & 1048576) == 1048576) { //企业团购
            queryAc.isGroupPurchase = true;
            queryAc.groupSelectNum = item.quantity;
            queryAc.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryAc
          });
          break;
        case 6:
        case 8:
        case 9:
        case 10:
        case 11:
        case 26:
        case 56:
        case 61:
        case 62:
        case 75:
        case 77:
        case 103:
          let queryT = {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: item.prodType == 9 ? item.isDeductedByInvitationCard : 0,
              isFromOrder: "TRUE",
              attendId: item.tags == '4096' ? item.extId : '',
              recRelateId: item.tags == '4194304' ? item.extId : '',
              recType: item.tags == '4194304' ? 3 : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          if ((item.tags & 1048576) == 1048576) { //企业团购
            queryT.isGroupPurchase = true;
            queryT.groupSelectNum = item.quantity;
            queryT.groupPurchaseId = item.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryT
          });
          break;
        case 67:
        case 70:
        case 71:
        case 72:
        case 8075:
        case 8076:
        case 8077:
        case 8078:
        case 8079:
        case 8080:
        case 8083:
        case 8084:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 15:
        case 17:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType, // 问答进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 68:
        case 69:
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: {
              type: item.realProdType,
              prodId: item.prodId,
              pId: item.extId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 116:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType,
              jwSaleCourseSpecId: item.extId,
              studentId: item.extId1,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 8082:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.prodType,
              jwSaleCourseSpecId: item.extId,
              studentId: item.extId1,
              pId: item.jwMarketingId,
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 129:
        case 125:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              extId: item.prodId,
              ckFrom: item.prodType,
              isFromInvite: 0,
              cId: -1,
              isFromOrder: "TRUE",
              pId: item.tags == 8 || item.tags == 12 ? item.extId : '',
              attendId: item.tags == '4096' ? item.extId : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          });
          break;
        case 142:
        case 145:
        case 146:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: 0,
              extId: item.tags == '2' || item.tags == '4096' ? item.prodId : item.extId,
              ckFrom: item.realProdType,
              extraId: 0,
              attendId: item.tags == '4096' ? item.extId : '',
              orderId: item.orderId,
              tabIndex: this.type
            }
          })
          break;
        case 181:
        case 185:
        case 5000:
          let query = {
            cId: 0,
            extId: item.extId || item.prodId,
            ckFrom: item.realProdType,
            orderId: item.orderId,
            tabIndex: this.type
          }
          if (item.spec) {
            query.circleSpecDateType = item.spec.type;
            query.circleSpecDateVal = item.spec.val;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: query
          })
          break;
        case 190:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: item.prodId || 0,
              extId: 0,
              ckFrom: item.realProdType,
              orderId: item.orderId,
              tabIndex: this.type
            }
          })
          break;
        case 200:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: item.prodId,
              ckFrom: item.realProdType,
              rcdId: !!item.rcdId ? item.rcdId : '',
              number: 1,
            }
          });
          break;
        case 197:
          if (item.specType == 2) {
            let multipleTmp = {
              name: item.specName,
              id: item.extId,
              prods: item.prods
            }
            localStorage.setItem("collocationProds", JSON.stringify(multipleTmp));
          } else {
            localStorage.setItem("collocationProds", JSON.stringify(item.prods));
          }
          let queryData = {
            cId: -1,
            extId: item.prodId,
            ckFrom: item.realProdType,
            orderId: item.orderId,
            comboType: item.comboType,
            isFromOrder: "TRUE"
          }
          if (item.specType == 2) {
            queryData.isMultiple = 1
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryData
          });
          break;
      }
    },
    // 教务再次购买 到课程详情页
    goEduCourseDetail(prodId) {
      this.$routerGo(this, "push", {
        path: "/edu/eduDetail",
        query: { id: prodId },
      })
    },
    //分享
    wechatShare: function () {
      let shareUrl =
        window.location.href.split("#")[0] + "#" +
        this.$route.path + "?refereeId=" +
        localStorage.getItem("userId");
      utilJs.wechatConfig(shareUrl, "我的订单", "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      var shareUrl =
        window.location.href.split("#")[0] + "#" +
        this.$route.path + "?refereeId=" +
        localStorage.getItem("userId");
      utilJs.appShareTrue("我的订单", "", shareUrl, "");
    },
    windowScrollFunction: function () {
      utilJs.handleLoading(() => {
        if (this.dataStatus == 'HAS_MORE_DATA' && this.allOrderList.length > 0) {
          // this.getOrderList();
          if (this.orderVersion == 1) {
            this.getOrderList();
          } else {
            this.getOrderListV2();
          }
        }
      });
    },
    initData() {
      this.dataStatus = 'HAS_MORE_DATA';
      this.allOrderList = [];
      this.$store.commit('updateAllOrderList', []);
      pageIndex = 1;
      getType = 1;
      this.isShowAddressInfo = false;
      this.currentConsigneeData = null;
      this.typeMap = JSON.parse(JSON.stringify(global.prodMapType));
      this.typeMap[global.ckFrom.qa] = localStorage.getItem("questionCustom") == 1 ? "预约专区" : "问答提问";
      this.typeMap[global.ckFrom.answer] = localStorage.getItem("questionCustom") == 1 ? "预约专区" : "付费问答";
      this.typeMap[global.ckFrom.circusee] = localStorage.getItem("questionCustom") == 1 ? "围观预约" : "围观解答";
      if (this.orderVersion == 1) {
        this.typeMap[global.ckFrom.agentApply] = JSON.parse(localStorage.getItem("customName")).agentName;
        this.typeMap[global.ckFrom.partnerApply] = JSON.parse(localStorage.getItem("customName")).partnerName;
        this.typeMap[global.ckFrom.branchApply] = JSON.parse(localStorage.getItem("customName")).branchName;
        this.typeMap[global.ckFrom.cooApply] = JSON.parse(localStorage.getItem("customName")).cooName;
        this.typeMap[global.ckFrom.agencyApply] = JSON.parse(localStorage.getItem("customName")).agencyName;
        this.typeMap[global.ckFrom.agent6Apply] = JSON.parse(localStorage.getItem("customName")).agent6Name;
        this.typeMap[global.ckFrom.agent7Apply] = JSON.parse(localStorage.getItem("customName")).agent7Name;
        this.typeMap[global.ckFrom.agent8Apply] = JSON.parse(localStorage.getItem("customName")).agent8Name;
        this.typeMap[global.ckFrom.agent9Apply] = JSON.parse(localStorage.getItem("customName")).agent9Name;
      }
      utilJs.getGiftCardInfo().then(res => {
        this.typeMap[global.ckFrom.giftCard] = res.name || '虚拟币';
      })
      if (this.orderVersion == 1) {
        this.getOrderList();
      } else {
        this.getOrderListV2();
      }
    },
    //通过名称模糊搜索
    startSearch(e) {
      this.searchValue = e.searchValue;
      this.initData();
    },
    // 新版
    getOrderListV2(index) {
      if (getType == 2 && index == undefined) {
        getType = 1;
        return
      }
      this.$loading.show();
      if (this.dataStatus == 'LOADING') {
        return;
      }
      this.dataStatus = 'LOADING';
      // let t = this.type == -1 ? '' : this.type;
      let t = this.type;
      let page = getType == 2 ? parseInt(index / 10) + 1 : pageIndex;
      utilJs.getMethod(global.apiurl + "aggOrder/getAggOrderList?page=" + page + "&status=" + t + "&searchName=" + this.searchValue + (this.fromOrderType ? '&fromOrderType=' + this.fromOrderType : ''),
        res => {
          let allOrderList = this.allOrderList;
          let list = res.data || [];
          if (getType == 1) {
            list.forEach((item, index) => {
              if (flashCkFromToNew[item.prodType] && item.tags == 8) {
                item.realProdType = flashCkFromToNew[item.prodType]; //跳转到支付页面的时候ckfrom用这个realProdType
              } else {
                item.realProdType = item.prodType;
              }
            })
            if (pageIndex == 1) {
              allOrderList = list;
              allOrderList.forEach((item, index) => {
                item.totalDiscountPrice * 1 > 0 ? allOrderList[index].totalDiscountSign = 1 : allOrderList[index].totalDiscountSign = 0;
                this.setPriceHtml(item);
              })
            } else {
              list.forEach((item, index) => {
                item.totalDiscountPrice * 1 > 0 ? list[index].totalDiscountSign = 1 : list[index].totalDiscountSign = 0;
                this.setPriceHtml(item);
              })
              allOrderList = [...allOrderList, ...list];
            }
            if (!res.next_page_url) {
              this.dataStatus = allOrderList.length == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
            } else {
              this.dataStatus = 'HAS_MORE_DATA';
              pageIndex++;
            }
            this.$store.commit('updateAllOrderList', allOrderList);
          } else {
            let item = list[list.length - 1];
            allOrderList.push(item);
            this.$store.commit('updateAllOrderList', allOrderList);
            getType = 1;
          }
          this.$loading.hide();
        },
        failRes => {
          this.dataStatus = 'DATA_ERROR';
          this.$loading.hide();
        }
      );
    },
    initVersion2Activated() {
      this.wechatShare();
      window.addEventListener('scroll', this.windowScrollFunction);
      //新版订单详情返回的时候，判断当前是否订单是否产生变更 --改成所有情况，只要返回列表，列表的数据有值，就检验需不需要刷新列表
      //如果是从个人中心进来的，则默认需要重新获取整个订单列表
      // const updateRouterList = ['/member/myOrder/knowledgeOrderDetail', '/mall/mallOrder/orderDetail', '/mall/shopComments/addShopComment'];
      if (this.allOrderList.length && this.pathFrom != '/member/memberIndex') {
        this.checkOrderStatusByNo();
        return;
      }
      setDocumentTitle("我的订单");
      this.fromOrderType = this.$route.query.fromOrderType || '';
      let queryOrderType = this.$route.query.orderType;
      queryOrderType = (queryOrderType === 0 || queryOrderType === '0') ? 0 : (queryOrderType || -1);
      this.type = Number(queryOrderType);
      if (window.location.href.includes('rbPay=1')) {
        //日本支付回调回来延迟2s再调接口，防止支付回调还没到，显示待支付，同时去掉支付成功后第三方回调带的一堆参数
        let newUrl = `${window.location.href.split("#")[0]}#/member/myOrder/allOrderList`;
        window.history.replaceState("allOrderList", "", newUrl);
        setTimeout(() => {
          this.searchValue = '';
          this.initData()
        }, 2000);
      } else {
        this.searchValue = '';
        this.initData()
      }
    },
  },
  activated() {
    if (this.orderVersion == 2) {
      this.initVersion2Activated();
      return;
    }
    let queryOrderType = this.$route.query.orderType;
    queryOrderType = (queryOrderType === 0 || queryOrderType === '0') ? 0 : (queryOrderType || -1);
    this.type = Number(queryOrderType);
    this.fromOrderType = this.$route.query.fromOrderType || '';
    if (this.fromOrderType == 2) {
      this.$store.commit('updateAllOrderList', []);
    }
    setDocumentTitle("我的订单");// eslint-disable-line
    if (window.location.href.includes('rbPay=1')) {
      //日本支付回调回来延迟2s再调接口，防止支付回调还没到，显示待支付，同时去掉支付成功后第三方回调带的一堆参数
      let newUrl = `${window.location.href.split("#")[0]}#/member/myOrder/allOrderList`;
      window.history.replaceState("allOrderList", "", newUrl);
      setTimeout(() => {
        if (utilJs.checkNeedInitData(this.allOrderList)) {
          this.searchValue = '';
          this.initData()
        }
      }, 2000);
    } else {
      if (utilJs.checkNeedInitData(this.allOrderList) || this.pathFrom == '/homePage/course/coursePay' || this.pathFrom == '/homePage/payPolitely/payPolitely' || this.pathFrom == '/member/vip/vipBuy') {
        this.searchValue = '';
        this.initData()
      }
    }
    this.wechatShare();
    window.addEventListener('scroll', this.windowScrollFunction);
  },
  deactivated() {
    window.removeEventListener('scroll', this.windowScrollFunction);
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.jt{
  position: absolute;
  bottom: -0.5rem;
  right: 1.25rem;
  width: 0;
  height: 0;
  border-left: 0.25rem solid transparent;
  border-right: 0.25rem solid transparent;
  border-top: 0.5rem solid #fafbfc;
}
/deep/ .dialog-modal .weui-dialog {
  border-radius: .5rem!important;
}
.boxShadow {
  box-shadow: 0px 0px 9px 0px rgba(204,204,204,0.20);
}
.my-ticket {
  color: #FF9458;
  background-color: rgba(255, 135, 130, 0.20);
}
.backdropFilter2 {
  backdrop-filter: blur(8px);
}
.glass {
  background-image: url("../../../assets/i/wap/datum/glass.png");
}
</style>
